<div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <form id="my-form" class="am-form tpl-form-line-form" method="post">
                <div class="widget-body">
                    <fieldset>
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">分红修正</div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">订单号 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" class="tpl-form-input" name="order_no"
                                       value="" placeholder="订单号" required onblur="queryOrder(this.value)">
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-form-label">完结订单不分账</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="finishDividend"
                                           value="finishDividend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">用户升级为微股东</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="userUpgrade"
                                           value="userUpgrade" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">订单加入分红队列</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="joinReceives"
                                           value="joinReceives" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">调用微信退款接口本订单分红</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="callWxRefund"
                                           value="callWxRefund" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">增加分红退款记录到分红流水表</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="receivesUserAppend"
                                           value="receivesUserAppend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">本次订单从分红队列中出局</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="finishReceives"
                                           value="finishReceives" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">创建平台分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="systemDividendCreate"
                                           value="systemDividendCreate" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">创建服务商分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="serviceDividendCreate"
                                           value="serviceDividendCreate" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">创建商户分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="storeDividendCreate"
                                           value="storeDividendCreate" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">调用微信分账接口进行分账</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="callWxDividend"
                                           value="callWxDividend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">更新平台分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="updateSystemDividend"
                                           value="updateSystemDividend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">更新服务商分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="updateServiceDividend"
                                           value="updateServiceDividend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">更新商户分账订单</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="updateStoreDividend"
                                           value="updateStoreDividend" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <label class="am-u-sm-3 am-form-label">之前订单入分红队列</label>
                            <div class="am-u-sm-9">
                                <label class="am-checkbox-inline">
                                    <input type="checkbox" name="op[]" id="otherJoinBonusQueue"
                                           value="otherJoinBonusQueue" data-am-ucheck>
                                    执行
                                </label>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </div>
                    </fieldset>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
	$(function () {
		/**
		 * 表单验证提交
		 * @type {*}
		 */
		$('#my-form').superForm();
	});

	function queryOrder(order)
    {
    	if(order) {
			$.get('admin/fix.bonus/query?order_no=' + order, function(ret){
				ret.data.forEach(function(item){
					console.log(item);
					let selector = "#" + item.process;
					$(selector).attr("checked",true).attr("disabled",true).removeAttr("name");
				});
			});
        }
    }
</script>
